<% link = @user.present? ? spree.admin_user_gift_card_path(gift_card, user_id: @user.id) : spree.admin_gift_card_path(gift_card) %>

<tr id="<%= spree_dom_id gift_card %>" data-controller="row-link">
  <td class="w-25 py-0">
    <%= link_to gift_card.code.upcase, link, class: 'font-weight-bold d-block w-100 h-100 py-2', data: { 'turbo-frame': '_top', row_link_target: :link } %>
  </td>
  <td class="w-10 cursor-pointer" data-action="click->row-link#openLink"><%= gift_card.display_amount %></td>
  <td class="w-10 cursor-pointer" data-action="click->row-link#openLink"><%= gift_card.display_amount_used %></td>
  <td class="w-10 cursor-pointer" data-action="click->row-link#openLink"><%= gift_card.currency.upcase %></td>
  <td class="w-10 cursor-pointer" data-action="click->row-link#openLink"><%= active_badge(gift_card.active?, label: gift_card.display_state) %></td>
  <td class="w-10 cursor-pointer" data-action="click->row-link#openLink">
    <% if gift_card.expires_at.present? %>
      <%= spree_date(gift_card.expires_at) %>
    <% else %>
      <span class="text-muted">
        <%= Spree.t(:not_available) %>
      </span>
    <% end %></td>
  <td class="w-15 cursor-pointer" data-action="click->row-link#openLink">
    <% if gift_card.user.present? %>
      <%= gift_card.user.email %>
    <% else %>
      <span class="text-muted">
        <%= Spree.t(:not_available) %>
      </span>
    <% end %>
  </td>
</tr>
